﻿<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net"
         xmlns:tx="http://www.springframework.net/tx"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:db="http://www.springframework.net/database">

  <object type="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer, Spring.Core">
    <property name="ConfigSections" value="databaseSettings" />
  </object>
  <db:provider id="DbProvider" provider="System.Data.SqlClient" connectionString="server=.;database=uqbuy;uid=sa;pwd=sa;"/>
  <object id="NHibernateSessionFactory" type="Dao.UQBuy.MyLocalSessionFactoryObject, Dao.UQBuy">
    <property name="DbProvider" ref="DbProvider"/>
    <property name="ModelAssemblyName">
      <list>
        <value>Domain.UQBuy.Model</value>
      </list>
    </property>
    <property name="HibernateProperties">
      <dictionary>
        <entry key="hibernate.current_session_context_class" value="Spring.Data.NHibernate.SpringSessionContext, Spring.Data.NHibernate33"/>
        <entry key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />


        <!--数据库方言-->
        <entry key="dialect" value="NHibernate.Dialect.MsSql2008Dialect"/>
        <!--数据库驱动-->
        <entry key="connection.driver_class" value="NHibernate.Driver.SqlClientDriver"/>
        <entry key="use_outer_join" value="true"/>
        <entry key="show_sql" value="false"/>
        <!--自动建表(反向映射)-->
        <entry key="hbm2ddl.auto" value="update"/>
        <!--超时时间-->
        <entry key="command_timeout" value="60"/>
        <entry key="query.substitutions" value="true 1, false 0, yes 'Y', no 'N'"/>
      </dictionary>
    </property>

    <!--与 Spring 的声明式事务集成 -->
    <property name="ExposeTransactionAwareSessionFactory" value="true" />
  </object>

  <object id="HibernateTemplate" type="Spring.Data.NHibernate.Generic.HibernateTemplate">
    <property name="SessionFactory" ref="NHibernateSessionFactory" />
    <property name="TemplateFlushMode" value="Auto" />
    <property name="CacheQueries" value="true" />
  </object>

  <object id="UserDao" type="Dao.UQBuy.Implement.UserDao,Dao.UQBuy">
    <property name="HibernateTemplate" ref="HibernateTemplate"/>
  </object>

  <object id="User" type="Dao.UQBuy.Implement.User,Dao.UQBuy">
    <property name="HibernateTemplate" ref="HibernateTemplate"/>
  </object>
</objects>